package com.hzyb.shopProductSpecifications.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.hzyb.shopProductSpecifications.dao.ShopProductSpecificationsDao;
import com.hzyb.shopProductSpecifications.model.ShopProductSpecifications;
import com.hzyb.shopProductSpecifications.service.ShopProductSpecificationService;
@Service
public class ShopProductSpecificationServiceImpl implements ShopProductSpecificationService{

	@Resource
	private ShopProductSpecificationsDao shopProductSpecificationsDao;

	@Override
	public List<Map<String, Object>> getShopProductSpecificationsBycommoditySid(String commoditySid) {
		List<ShopProductSpecifications> list=shopProductSpecificationsDao.findByCommoditySid(commoditySid);
		List<Map<String, Object>> result=new ArrayList<>();
		for(ShopProductSpecifications shopProductSpecifications:list) {
			Map<String, Object> map=new HashMap<>();
			map.put("name", shopProductSpecifications.getName());
			map.put("value", shopProductSpecifications.getValue());
			map.put("unit", shopProductSpecifications.getUnit());
			map.put("specificationSid", shopProductSpecifications.getSpecificationSid());
			result.add(map);
		}
		return result; 
	}



}
